package com.cxrj.zhsq.partyMember.controller;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.cxrj.zhsq.annotation.SystemControllerLog;
import com.cxrj.zhsq.partyMember.entity.Jobs;
import com.cxrj.zhsq.partyMember.service.PartyMemberJobsService;


@RestController
@RequestMapping("/jobs")
public class PartyMemberJobsController {
	@Resource
	private PartyMemberJobsService  memberJobsService;
	
	/**
	 * 查询所有数据
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "selectJobsPage", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public Map<String, Object> selectJobsPage(HttpServletRequest request,HttpServletResponse response){
		return memberJobsService.selectJobsPage(request,response);
	}
	
	/**
	 * 添加岗位
	 * @param jobs
	 * @return
	 */
	@RequestMapping("insertJobs")
	@SystemControllerLog(description = "添加岗位")
	public Map<String, Object> insertJobs(Jobs jobs,HttpServletRequest request,HttpServletResponse response){
		return memberJobsService.insertJobs(jobs,request,response);
	}
	
	/**
	 * 修改岗位
	 * @param jobs
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("updateJobs")
	public Map<String, Object> updateJobs(Jobs jobs,HttpServletRequest request,HttpServletResponse response){
		return memberJobsService.updateJobs(jobs,request,response);
	}
	
	/**
	 * 根据Id查询
	 * @param jobsId
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("selectJobsById")
	public Map<String, Object> selectJobsById(String jobsId,HttpServletRequest request,HttpServletResponse response){
		return memberJobsService.selectJobsById(jobsId,request,response);
	}
	
	/**
	 * 查询申请
	 * @param jobsId
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("selectJobsApply")
	public Map<String, Object> selectJobsApply(String jobsId,HttpServletRequest request,HttpServletResponse response){
		return memberJobsService.selectJobsApply(jobsId,request,response);
	}
	/**
	 * 通过审核
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("passJobsApply")
	public Map<String, Object> updatePassJobsApply(HttpServletRequest request,HttpServletResponse response){
		return memberJobsService.updatePassJobsApply(request,response);
	}
	
	/**
	 * 直接任岗
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("directlyPassJob")
	public Map<String, Object> directlyPassJob(String userJob,String jobsId,HttpServletRequest request,HttpServletResponse response){
		return memberJobsService.insertDirectlyPassJob(userJob,jobsId,request,response);
	}
	/**
	 * 任岗人员
	 * @param aId
	 * @return
	 */
	@RequestMapping("selectJobsApplyByJobsId")
	public Map<String, Object> selectJobsApplyByJobsId(String jobsId){
		return memberJobsService.selectJobsApplyByJobsId(jobsId);
	}

}
